const P = require('bluebird') // 利用第三方模块创建Promise
function p1 () {
  return new P((resolve, reject) => {
    resolve('1')
  })
}
p1().then(res => console.log(res))


// 直接将以部方法转化为Promise
const read_promise = P.promisify(require('fs').readFile)
read_promise('../bar.txt').then(result => {
  console.log(result.toString())
})
.catch(err => console.log(err))